package com.hexinfo.dmpro.monitor.dao;

import com.hexinfo.dmpro.monitor.model.CmStatementAudit.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface CmStatementAuditDao {

    List<Map<String,String>> selectClusterName();

    List<Map<String,String>> selectAllCluster();

    List<String> selectModelNameByCluster(String component);

//    组件审计汇总************************************

    List<Map<String,String>> selectImpalaAuditAlarm(ComponentMonthModel model);

    List<Map<String,String>> selectYarnAuditAlarm(ComponentMonthModel model);

    List<Map<String,String>> selectImpalaModelSummary(ComponentMonthModel model);

    List<Map<String,String>> selectYarnModelSummary(ComponentMonthModel model);

    List<ConfigureModel> selectModelIsExists(ConfigureModel model);

    List<ConfigureModel> findConfigModel(ConfigureModel model);

    List<ComponentModel> selectYarnModelDetails(ComponentMonthModel model);

    List<ComponentModel> selectImpalaModelDetails(ComponentMonthModel model);

    List<ComponentModel> selectImpalaComponentDetails(ComponentMonthModel model);

    List<ComponentModel> selectYarnComponentDetails(ComponentMonthModel model);

    /**
     * 数据插入模型配置
     * @param model
     */
    void insertConfigModel(ConfigureModel model);

    void updateConfigModel(ConfigureModel model);

    void deleteConfigModel(String id);

    List<ConfigureModel> selectModelConfig(@Param("componentType") String componentType, @Param("isErrorModel") String isErrorModel);

    //Impala月份区间，连表查询
    List<ImpalaParameterModel> selectImpalaParamMonth(ComponentMonthModel model);

    //Yarn月份区间，连表查询
    List<YarnParameterModel> selectYarnParamMonth(ComponentMonthModel model);


//    *****************************定时任务************************

    //语句审计保留历史记录（2年）数据表按照月份表
    void insertMonthImpalaParameterData(ImpalaParameterMonthModel imp);

    //语句审计保留历史记录（2年）数据表按照月份表
    void insertMonthYarnParameterData(Map map);

    List<Map> selectImpalaConcurrency(@Param("queryType") String queryType,@Param("tableInfo") String tableInfo
            ,@Param("startTime") String startTime,@Param("endTime") String endTime,
            @Param("tableName")String tableName,@Param("tableNameList")List<String> tableNameList);

    List<Map> selectMapreduceConcurrency(@Param("tableInfo") String tableInfo,@Param("startTime") String startTime
            ,@Param("endTime") String endTime,
            @Param("tableName")String tableName,@Param("tableNameList")List<String> tableNameList);

}
